package com.mycat.auth.dao.mapper;

import com.mycat.auth.dao.core.MyBatisBaseMapper;
import com.mycat.auth.domain.AuthResource;
import com.mycat.auth.dto.auth.MenuResourcesDTO;
import com.mycat.auth.dto.auth.ResourcesTreeDTO;
import com.mycat.auth.dto.auth.RoleAuthTreeDTO;

import java.util.List;
import java.util.Map;

/**
 * AuthResourceMapper
 * Date:2016-8-26 16:02:39
 *
 * @author Roger
 */
public interface AuthResourceMapper extends MyBatisBaseMapper<AuthResource> {

    AuthResource selectAuthResource(AuthResource resource);

    List<AuthResource> selectAuthResources(AuthResource resource);

    /**
     * 根据角色Id获取该角色下所有权限
     *
     * @param roleIds 角色集合
     * @return 资源集合
     */
    List<AuthResource> selectPermissionByRoleIds(Integer... roleIds);

    /**
     * 获取左侧菜单资源
     *
     * @param param 参数
     * @return List<ResourcesDTO>
     */
    List<MenuResourcesDTO> selectPageResources(Map<String, Object> param);

    /**
     * 获取单个资源
     *
     * @param param 参数
     * @return ResourcesDTO
     */
    MenuResourcesDTO selectResourcesDTO(Map<String, Object> param);

    /**
     * 获取资源树
     *
     * @param param 参数
     * @return List<ResourcesTreeDTO>
     */
    List<ResourcesTreeDTO> selectResourceTreeDTOs(Map<String, Object> param);

    /**
     * 获取角色授权树的数据
     * @param parentId 父节点
     * @return List<RoleAuthTreeDTO>
     */
    List<RoleAuthTreeDTO> selectRoleAuthTreeDTO(Integer parentId);
}